package com.jowell.common.utils;

import com.jowell.common.result.Result;

/**
 * @author ：Mr.ZJW
 * @date ：Created 2022/3/10 15:02
 * @description：返回编码信息
 */
public class CodeMsg {
    private int retCode;
    private String message;

    // 按照模块定义CodeMsg

    // 通用异常
    public static final CodeMsg SUCCESS = new CodeMsg(Result.OK, "success");
    public static final CodeMsg ERROR = new CodeMsg(Result.ERROR, "error");
    public static final CodeMsg PARAMETER_ISNULL = new CodeMsg(Result.ERROR, "输入参数为空");
    public static final CodeMsg PARAMETER_ERROR = new CodeMsg(Result.ERROR, "输入参数异常");
    public static final CodeMsg SERVER_EXCEPTION = new CodeMsg(500100, "服务端异常");

    // 业务异常
    public static final CodeMsg USER_NOT_EXSIST = new CodeMsg(500102, "用户不存在");
    public static final CodeMsg ONLINE_USER_OVER = new CodeMsg(500103, "在线用户数超出允许登录的最大用户限制。");
    public static final CodeMsg SESSION_NOT_EXSIST = new CodeMsg(500104, "不存在离线session数据");
    public static final CodeMsg NOT_FIND_DATA = new CodeMsg(Result.ERROR, "查找不到对应数据");
    public static final CodeMsg USER_NOT_AVAILABLE = new CodeMsg(Result.ERROR, "该账号不可用，如有问题联系请管理员!");
    public static final CodeMsg CODE_IS_NULL = new CodeMsg(Result.ERROR, "请输入验证码");

    public static final CodeMsg LOGIN_SUCCESS = new CodeMsg(Result.OK, "登陆成功");
    public static final CodeMsg LOGIN_ERROR_PASS = new CodeMsg(Result.ERROR, "用户名或密码错误");
    public static final CodeMsg LOGIN_ERROR_CODE = new CodeMsg(Result.ERROR, "验证码错误");

    public static final CodeMsg ADD_SUCCESS = new CodeMsg(Result.OK, "添加成功");

    public static final CodeMsg ADD_SUCCESS_SAME = new CodeMsg(Result.OK, "已存在");
    public static final CodeMsg ADD_ERROR = new CodeMsg(Result.ERROR, "添加失败");

    public static final CodeMsg DELETE_SUCCESS = new CodeMsg(Result.OK, "删除成功");
    public static final CodeMsg DELETE_ERROR = new CodeMsg(Result.ERROR, "删除失败");

    public static final CodeMsg UPDATE_SUCCESS = new CodeMsg(Result.OK, "修改成功");
    public static final CodeMsg UPDATE_ERROR = new CodeMsg(Result.ERROR, "修改失败");

    public static final CodeMsg AFFIRM_SUCCESS = new CodeMsg(Result.OK, "确认成功");
    public static final CodeMsg AFFIRM_ERROR = new CodeMsg(Result.ERROR, "确认失败");

    public static final CodeMsg DISABLE_SUCCESS = new CodeMsg(Result.OK, "禁用成功");
    public static final CodeMsg DISABLE_ERROR = new CodeMsg(Result.ERROR, "禁用失败");

    public static final CodeMsg CANAL_DISABLE_SUCCESS = new CodeMsg(Result.OK, "取消禁用成功");
    public static final CodeMsg CANAL_DISABLE_ERROR = new CodeMsg(Result.ERROR, "取消禁用失败");

    public static final CodeMsg IMPORT_SUCCESS = new CodeMsg(Result.OK, "导入成功");
    public static final CodeMsg IMPORT_ERROR = new CodeMsg(Result.ERROR, "导入失败");

    public static final CodeMsg INTEGRATE_SUCCESS = new CodeMsg(Result.OK, "集成成功");
    public static final CodeMsg INTEGRATE_ERROR = new CodeMsg(Result.ERROR, "集成失败");

    public static final CodeMsg RESET_SUCCESS = new CodeMsg(Result.OK,"重置成功");
    public static final CodeMsg RESET_ERROR = new CodeMsg(Result.ERROR,"重置失败");

    public static final CodeMsg ALLOCATION_SUCCESS = new CodeMsg(Result.OK,"分配成功");
    public static final CodeMsg ALLOCATION_ERROR = new CodeMsg(Result.ERROR,"分配失败");

    public static final CodeMsg BIND_SUCCESS = new CodeMsg(Result.OK,"绑定成功");
    public static final CodeMsg BIND_ERROR = new CodeMsg(Result.ERROR,"绑定失败");

    private CodeMsg(int retCode, String message) {
        this.retCode = retCode;
        this.message = message;
    }

    public int getRetCode() {
        return retCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}